package com.markhsiu.httpserver.event;

public enum HttpMethod {

	POST,GET,ERROR;
	
	public static HttpMethod toValue(String name){
		try{   
			HttpMethod m = HttpMethod.valueOf(name);  
			return m;
		}catch(Exception e){   
		    return ERROR;   
		}  
	}
	
	//是否包含枚举项   
    public static boolean contains(String name){   
        //所有的枚举值   
    	HttpMethod[] methods = values();   
       //遍历查找   
       for(HttpMethod m : methods){   
           if(m.name().equals(name)){   
               return true;   
           }   
       }   
   
       return false;   
    }   
}
